<%@ page language="java" contentType="text/html;charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->
<head>
    <jsp:include page="../common/common.jsp"/>
</head>
<body class="page-header-fixed page-sidebar-fixed">
<jsp:include page="../common/header.jsp"/>
<div class="clearfix">
</div>
<div class="page-container">
    <div class="page-sidebar-wrapper"><jsp:include page="../common/menu.jsp"/></div>
    <div class="page-content-wrapper">
        <div class="page-content">
            <div class="row">
                <div class="col-md-12">
                    <form class="form-horizontal form-row-seperated" action="${path}/article/upd">
                        <div class="portlet box purple">
                            <div class="portlet-title">
                                <div class="caption">
                                    <i class="fa fa-shopping-cart"></i>添加规则信息
                                </div>
                                <div class="actions btn-set">
                                    <button type="button" id="btnSave" class="btn blue"><i class="fa fa-check"></i> 保存
                                    </button>
                                    <a href="javascript:location.reload();" class="btn green"><i
                                            class="fa fa-reply"></i> 重置</a>
                                </div>
                            </div>
                            <div class="portlet-body">
                                <div class="tabbable">
                                    <div class="tab-content no-space">
                                        <div class="tab-pane active" id="tab_general">
                                            <div class="form-body">
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">类型:
                                                        <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-5">
                                                        <select name="columnid" class="form-control">
                                                            <option value="">-请选择-</option>
                                                            <option value="">模糊配置</option>
                                                            <option value="">精准配置</option>
                                                            <option value="">首次关注</option>
                                                            <option value="">默认回复</option>
                                                            <option value="">LBS信息</option>
                                                        </select></div>
                                                    <div class="col-md-5">
                                                        &nbsp;
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">关键词:
                                                        <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-5">
                                                        <input type="text" id="title" name="title"
                                                               class="form-control measure-input" datatype="*1-80"
                                                               value="${data.title}"/>
                                                    </div>
                                                    <div class="col-md-5">
                                                        &nbsp;多个关键词请用空格格开：例如: 美丽 漂亮 好看
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">权重:
                                                    </label>

                                                    <div class="col-md-5">
                                                        <input type="text" id="title" name="title"
                                                               class="form-control measure-input" datatype="*1-80"
                                                               value="${data.title}"/>
                                                    </div>
                                                    <div class="col-md-5">
                                                        &nbsp;关键词相同权重值高优先
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">素材资源 :
                                                        <span class="required">*</span>
                                                    </label>

                                                    <div class="col-md-5">
                                                        <select name="columnid" class="form-control">
                                                            <option value="">-请选择-</option>
                                                            <option value="">文本消息</option>
                                                            <option value="">单图文消息</option>
                                                            <option value="">多图文消息</option>
                                                        </select>
                                                    </div>
                                                    <div class="col-md-5">
                                                        &nbsp;
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-md-2 control-label">描述:
                                                    </label>

                                                    <div class="col-md-8">
                                                        <textarea cols="80" id="context" name="context" datatype="*"
                                                                  rows="10"></textarea></div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                            <div class="portlet-title">
                                <div class="actions btn-set">
                                    <a href="javascript:history.go(-1);" class="btn default"><i
                                            class="fa fa-angle-left"></i> 返回</a>
                                    <a href="javascript:location.reload();" class="btn green"><i
                                            class="fa fa-reply"></i> 重置</a>
                                    <button type="button" id="btnSave" class="btn blue"><i class="fa fa-check"></i> 保存
                                    </button>
                                </div>
                            </div>
                        </div>
                        <input type="hidden" id="id" name="id" value="${data.id}">
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="../common/footer.jsp"/>
<%-- <script type="text/javascript" src="${path}/assets/plugins/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="${path}/assets/plugins/bootstrap-fileinput/bootstrap-fileinput.js" ></script>
<script type="text/javascript" src="${path}/assets/plugins/jquery-inputmask/jquery.inputmask.bundle.min.js" ></script>
<script type="text/javascript" src="${path}/assets/plugins/jquery.input-ip-address-control-1.0.min.js" ></script>
<script type="text/javascript" src="${path}/assets/plugins/jquery.pwstrength.bootstrap/src/pwstrength.js"></script>
 --%>
<script>
    var operType = '${operType}';
    var editor, form;
    jQuery(document).ready(function () {
        form = $("form").Validform({
            tiptype: 3,
            postonce: true,
            showAllError: true,
            callback: function (data) {
                if (data && data.statusCode === 200) {
                    /* var id = $("#id");
                     if(!id.val())
                     id.val(data.id);
                     if(confirm("保存成功，是否跳转到智库管理页面？")) */
                    window.location.href = _path + "/article/init/" + operType + "/" + operType;
                } else {
                    alert("保存失败！");
                }
            }
        });
        $("button[id='btnSave']").click(function (e) {
// 		var context = editor.getData();
            var context = $('#editor').html();
            if (!/[\w\W]+/.test(context)) {
                alert("内容不能为空");
                return;
            }
            $("#context").val(context);
            form.ajaxPost(false, true, _path + "/article/save");
        });
//     editor = CKEDITOR.replace('context');
    });
</script>
</body>
</html>